//
//  BaseViewController.m
//  WXWeibo
//
//  Created by apple on 16/5/9.
//  Copyright © 2016年 zic_magic. All rights reserved.
//

#import "BaseViewController.h"
#import "ThemeManager.h"
#import "MBProgressHUD.h"
#import "ThemeButton.h"

@interface BaseViewController ()
@property (nonatomic, strong) UIImageView *navigationBarBottomLine;
@end

@implementation BaseViewController

- (instancetype)initWithCoder:(NSCoder *)aDecoder{
    
    if (self = [super initWithCoder:aDecoder]) {
        
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(themeChange) name:kThemeChangeNotification object:nil];
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self themeChange];

    
    
}

- (void)themeChange{
    
    //先根据图片名加载UIImage
    //再把Image转成颜色
    self.view.backgroundColor = [UIColor colorWithPatternImage:[[ThemeManager shareManager] themeImageWithImageName:@"bg_home.jpg"]];
}




//- (void)viewDidLoad {
//    [super viewDidLoad];
////    
////    [self hiddenTabBarTopLine];
////    self.navigationBarBottomLine = [self findBottomLineUnder:self.navigationController.navigationBar];
// 
//    
//}



//- (void)hiddenTabBarTopLine {
//    
//    for (UIView *view in self.tabBarController.tabBar.subviews) {
//        
//        if ([view isKindOfClass:[UIImageView class]] && view.bounds.size.height <= 1) {
//            UIImageView *img = (UIImageView *)view;
//            img.hidden = YES;
//        }
//    }
//}
//
//
//
//- (UIImageView *)findBottomLineUnder:(UIView *)view {
//    
//    if ([view isKindOfClass:[UIImageView class]] && view.bounds.size.height <= 1) {
//        return (UIImageView *)view;
//    }
//    for (UIView *subview in view.subviews) {
//        UIImageView *imageView = [self findBottomLineUnder:subview];
//        if (imageView) {
//            return imageView;
//        }
//    }
//    return nil;
//}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    self.navigationBarBottomLine.hidden = YES;
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
